import request from "@/request"

export function getAllArticle() {
    return request({
        method: 'get',
        url: '/article/getAllArticle',
        // data:params
    })
}
export function getRecommendArticle() {
    return request({
        method: 'get',
        url: '/article/getRecommendArticle',

    })
}
export function getHotArticles() {
    return request({
        method: 'get',
        url: '/article/getHotArticle',
    })
}
export function getNewArticles() {
    return request({
        method: 'get',
        url: '/article/getNewArticle',
    })
}
export function getArticleById(id) {
    return request({
        method: 'get',
        url: `/article/view/${id}`,
    })
}
export function publishArticle(token,article) {
    return request({
        method: 'post',
        headers: {'Authorization': token},
        url: '/article/publish',
        data: article
    })
}
export function searchArticle(search) {
    return request({
        url: '/article/searchArticle',
        method: 'post',
        data: {"searchVal":search}
    })
}
export function getAllUseArticle(pagination) {
    return request({
        method: 'post',
        url: '/admin/getAllUseArticle',
        data: pagination
    })
}
export function deleteUserArticle(id) {
    return request({
        method: 'get',
        url: `/admin/deleteUserArticle/${id}`,
    })
}
export function chgArticleCategory(id,form) {
    return request({
        method: 'post',
        url: `/admin/chgArticleCategory/${id}`,
        data: form
    })
}

